//封装弹框的方法
uni.$showMsg = function(title = '数据请求失败!', duration = 1500) {
	uni.showToast({
		title: title,
		duration: duration,
		icon: 'none'
	})
}

// #ifndef VUE3
import Vue, {
	ssrContextKey
} from 'vue'
import App from './App'

Vue.config.productionTip = false

App.mpType = 'app'


const app = new Vue({
	...App
})
app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
import App from './App.vue'
import store from './store/store.js'
export function createApp() {
	const app = createSSRApp(App)
	app.use(store)
	app.config.globalProperties.$socketIO = function() {
		const socketTask = uni.connectSocket({
			// url:'ws://192.168.0.113:8000',//本地
			url: 'ws://172.16.7.157:8000', //图书馆
			success: () => {
				console.log("正准备建立websocket中...");
				// // 返回实例
				// return this.socketTask
			},
		});

		socketTask.onOpen((res) => {
			console.log("WebSocket连接正常！");
			// 注：只有连接正常打开中,才能正常收到消息
			socketTask.onMessage((e) => {
				console.log("res---------->", e.data) // 这里 查看 推送过来的消息
				
			});
		})
	}
	return {
		app
	}
}
// #endif